package com.scsj.supermarket.view.activity.settingmodel;

import android.os.Bundle;
import android.view.View;
import android.widget.RelativeLayout;

import com.scsj.supermarket.R;
import com.scsj.supermarket.view.activity.baseactivitymodel.BaseActivity;
import com.vondear.rxtools.view.dialog.RxDialogSureCancel;

/**
 * 通用设置
 */
public class GeneralSettingsActivity extends BaseActivity implements View.OnClickListener {


    private RelativeLayout mCheckForUpdatesRl;
    private RelativeLayout mClearCacheRl;

    @Override
    protected void createView(Bundle savedInstanceState) {
        setContentView(R.layout.activity_general_settings);
        //ScreenAdapterTools.getInstance().loadView((ViewGroup) getWindow().getDecorView());
        //ScreenAdapterTools.getInstance().reset(this);//如果希望android7.0分屏也适配的话,加上这句
        initToolbar();
        setToolbarTitle("通用设置");
        hasBack(true);
        initView();
    }


    @Override
    protected void initListener() {

    }

    @Override
    protected void initData() {

    }




    public void initView() {
        mCheckForUpdatesRl = (RelativeLayout) findViewById(R.id.check_for_updates_rl);
        mCheckForUpdatesRl.setOnClickListener(this);
        mClearCacheRl = (RelativeLayout) findViewById(R.id.clear_cache_rl);
        mClearCacheRl.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            default:
                break;
            case R.id.check_for_updates_rl:
                break;
            case R.id.clear_cache_rl:
                final RxDialogSureCancel rxDialogSureCancel = new RxDialogSureCancel(this);//提示弹窗
                rxDialogSureCancel.setContent("是否清除缓存");
                rxDialogSureCancel.setSureListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        rxDialogSureCancel.cancel();
                    }
                });
                rxDialogSureCancel.setCancelListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        rxDialogSureCancel.cancel();
                    }
                });
                rxDialogSureCancel.show();
                break;
        }
    }
}
